<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css"> 
		<!--App自定义的css-->
		<style type="text/css">
			.mui-preview-image.mui-fullscreen {
				position: fixed;
				z-index: 20;
				background-color: #000;
			}
			
			.mui-preview-header,
			.mui-preview-footer {
				position: absolute;
				width: 100%;
				left: 0;
				z-index: 10;
			}
			
			.mui-preview-header {
				height: 44px;
				top: 0;
			}
			
			.mui-preview-footer {
				height: 50px;
				bottom: 0px;
			}
			
			.mui-preview-header .mui-preview-indicator {
				display: block;
				line-height: 25px;
				color: #fff;
				text-align: center;
				margin: 15px auto 4;
				width: 70px;
				background-color: rgba(0, 0, 0, 0.4);
				border-radius: 12px;
				font-size: 16px;
			}
			
			.mui-preview-image {
				display: none;
				-webkit-animation-duration: 0.5s;
				animation-duration: 0.5s;
				-webkit-animation-fill-mode: both;
				animation-fill-mode: both;
			}
			
			.mui-preview-image.mui-preview-in {
				-webkit-animation-name: fadeIn;
				animation-name: fadeIn;
			}
			
			.mui-preview-image.mui-preview-out {
				background: none;
				-webkit-animation-name: fadeOut;
				animation-name: fadeOut;
			}
			
			.mui-preview-image.mui-preview-out .mui-preview-header,
			.mui-preview-image.mui-preview-out .mui-preview-footer {
				display: none;
			}
			
			.mui-zoom-scroller {
				position: absolute;
				display: -webkit-box;
				display: -webkit-flex;
				display: flex;
				-webkit-box-align: center;
				-webkit-align-items: center;
				align-items: center;
				-webkit-box-pack: center;
				-webkit-justify-content: center;
				justify-content: center;
				left: 0;
				right: 0;
				bottom: 0;
				top: 0;
				width: 100%;
				height: 100%;
				margin: 0;
				-webkit-backface-visibility: hidden;
			}
			
			.mui-zoom {
				-webkit-transform-style: preserve-3d;
				transform-style: preserve-3d;
			}
			
			.mui-slider .mui-slider-group .mui-slider-item img {
				width: auto;
				height: auto;
				max-width: 100%;
				max-height: 100%;
			}
			
			.mui-android-4-1 .mui-slider .mui-slider-group .mui-slider-item img {
				width: 100%;
			}
			
			.mui-android-4-1 .mui-slider.mui-preview-image .mui-slider-group .mui-slider-item {
				display: inline-table;
			}
			
			.mui-android-4-1 .mui-slider.mui-preview-image .mui-zoom-scroller img {
				display: table-cell;
				vertical-align: middle;
			}
			
			.mui-preview-loading {
				position: absolute;
				width: 100%;
				height: 100%;
				top: 0;
				left: 0;
				display: none;
			}
			
			.mui-preview-loading.mui-active {
				display: block;
			}
			
			.mui-preview-loading .mui-spinner-white {
				position: absolute;
				top: 50%;
				left: 50%;
				margin-left: -25px;
				margin-top: -25px;
				height: 50px;
				width: 50px;
			}
			
			.mui-preview-image img.mui-transitioning {
				-webkit-transition: -webkit-transform 0.5s ease, opacity 0.5s ease;
				transition: transform 0.5s ease, opacity 0.5s ease;
			}
			
			@-webkit-keyframes fadeIn {
				0% {
					opacity: 0;
				}
				100% {
					opacity: 1;
				}
			}
			
			@keyframes fadeIn {
				0% {
					opacity: 0;
				}
				100% {
					opacity: 1;
				}
			}
			
			@-webkit-keyframes fadeOut {
				0% {
					opacity: 1;
				}
				100% {
					opacity: 0;
				}
			}
			
			@keyframes fadeOut {
				0% {
					opacity: 1;
				}
				100% {
					opacity: 0;
				}
			}
			
			div img {
				max-width: 100%;
				height: auto;
			}
		</style>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">购物指南</h1> 
			<a id="icon-more"><span class="mui-icon mui-icon-more" style="position: absolute;right:2%" onclick="sharepro()"></span></a> 
		</header>
		<div id="neirong" style="margin-top: 50px;margin-bottom: 50px;">
		</div>
		<div class="mui-bar mui-bar-tab" style="background-color: #95c32f;" onclick="GoBuy()">
			<h1 class="mui-title" style="font-size: 24px; color: #F0F0F0;">去购买></h1></div>
		<!---->

		<!--	<div class="mui-bar mui-bar-tab" style="background-color: #95c32f;" onclick="GoBuy()"> 
			<h1 class="mui-title" style="font-size: 24px; color: #F0F0F0;">去购买</h1>
		</div> -->

	</body>
	<script src="js/jquery-1.11.0.js"></script>
	<script src="js/mui.min.js"></script>
	<script src="js/mui.zoom.js"></script>
	<script src="js/share.js"></script>
	<script src="js/mui.previewimage.js"></script>
	<script>
		mui.previewImage();
		$(document).ready(function() {

			ShowDetail();
		});

		function ShowDetail() {
			/*	mui.plusReady(function() {
					plus.nativeUI.showWaiting();
				}); */
			var geturl = "http://www.maytao.cn/Home/GetModel?id=" + localStorage.pid;
			$.ajax({
				url: geturl,
				timeout: 5000,
				type: 'get',
				dataType: 'json',
				success: function(data) {
					/*mui.plusReady(function() { 
						plus.nativeUI.closeWaiting();
						 
					});*/
					if(data.Code == 0) {
						var modeobj = JSON.parse(data.Data)
						mui.plusReady(function() {
							plus.storage.setItem("plink", modeobj.Plink)
							
						});
						var cont = "";
						
						localStorage.plink=modeobj.Plink;
						localStorage.title=modeobj.Pname;
						localStorage.prisour=modeobj.Source + "  " + modeobj.Price
						localStorage.imgurl=modeobj.ImgUrl 
						 
						if(modeobj.ImgUrl != "") {
							var title = modeobj.Pname;
							var sourPri = modeobj.Source + "  " + modeobj.Price
							cont += '<div style="text-align:center;"><img  src=' + modeobj.ImgUrl + ' data-preview-src="" data-preview-group="1" /></div>'
							cont += '<p><h4>' + title + '</h1><font color="red">' + sourPri + '</font></p>'
						}
						if(modeobj.ImgUrl2 != "" && modeobj.ImgUrl2 != null) {
							cont += '<div style="text-align:center;"><img src=' + modeobj.ImgUrl2 + ' data-preview-src="" data-preview-group="1" /></div>'
						}
						if(modeobj.ImgUrl3 != "" && modeobj.ImgUrl3 != null) {
							cont += ' <div style="text-align:center;"><img src=' + modeobj.ImgUrl3 + ' data-preview-src="" data-preview-group="1" /></div>'
						}
						cont += '<p>' + modeobj.Description + '</p>'

						$("#neirong").prepend(cont);
					} else if(data.Code == -1) {
						mui.toast("来晚啦，商品飞走了，下次要抓紧哦");
					} else {
						mui.toast("稍后再试");
					}
				},
				complete: function(XMLHttpRequest, status) {　　　
					mui.plusReady(function() {
						plus.nativeUI.closeWaiting();

					});　　　
					if(status != "success") //超时,status还有success,error等值的情况
					{
						mui.toast("请检查网络状态是否良好")
					}
				}
			});
		}
		//点击打开新页面
		function GoBuy() {
			mui.plusReady(function() {
					var url1 = plus.storage.getItem("plink")
				 //打开关于页面
			mui.openWindow({
				url: 'detail.html',
				id: 'detail'
			});
				});
			
		}

		function closewin() {
			if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
				// window.location.href="about:blank";  
				window.close();
			} else {
				window.opener = null;
				window.open("", "_self");
				window.close();
			}
		}
	</script>

</html>